package com.agile.leetcode.easy;

/**
 * leetcode翻转字符串
 *
 * @Author KD
 * @Date 2021/1/27 9:32
 */
public class ReverseLeftWords {
    public static void main(String[] args) {
        ReverseLeftWords words = new ReverseLeftWords();
        String lrloseumgh = words.reverseLeftWords("lrloseumgh", 6);
        System.out.println(lrloseumgh);
    }

    public String reverseLeftWords(String s, int n) {
        // 截取
        if (n <= 0) {
            return s;
        }
        String substring = s.substring(0, n);
        String substring1 = s.substring(n);
        return substring1 + substring;
    }
}
